﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Revit;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class DetailLineDraw : AuxiliaryDraw
	{
		public DetailLineDraw(ExternalCommandData amdArgu, Dictionary<XYZ, XYZ> dicXArgu, Dictionary<XYZ, XYZ> dicYArgu, ref ICollection<ElementId> idsArgu) : base(amdArgu, dicXArgu, dicYArgu, ref idsArgu)
		{
		}

		public override bool DrawCurve()
		{
			if (!base.IsInTolerance())
			{
				return false;
			}
			if (this.dicX.Count < 1 && this.dicY.Count < 1)
			{
				return false;
			}
			foreach (KeyValuePair<XYZ, XYZ> keyValuePair in this.dicX)
			{
				DetailLine detailLine = YJKRevitTools.DrawDetailLine(this.m_CmdData.Application.ActiveUIDocument.Document, keyValuePair.Key, keyValuePair.Value);
				this.ids.Add(detailLine.Id);
			}
			foreach (KeyValuePair<XYZ, XYZ> keyValuePair2 in this.dicY)
			{
				DetailLine detailLine2 = YJKRevitTools.DrawDetailLine(this.m_CmdData.Application.ActiveUIDocument.Document, keyValuePair2.Key, keyValuePair2.Value);
				this.ids.Add(detailLine2.Id);
			}
			YJKRevitTools.SetDetailLineView(this.ids, this.m_CmdData);
			return true;
		}
	}
}
